package com.cjd.common.utils

import java.util.*

/**
 * @Author chenjidong
 * @email 374122600@qq.com
 * created 2015/9/6 17 29.
 * description
 */
object ColorUtils {
    /**
     * 获取十六进制的颜色代码.例如  "#6E36B4" , For HTML ,
     *
     * @return String
     */
    fun getRandColorCode(): String {
        var r: String
        var g: String
        var b: String
        val random = Random()
        r = Integer.toHexString(random.nextInt(256)).toUpperCase()
        g = Integer.toHexString(random.nextInt(256)).toUpperCase()
        b = Integer.toHexString(random.nextInt(256)).toUpperCase()

        r = if (r.length == 1) "0$r" else r
        g = if (g.length == 1) "0$g" else g
        b = if (b.length == 1) "0$b" else b

        return "#$r$g$b"
    }
}